<?php
/**
 * 检查数据表是否完整并自动赋予创建功能
 */


if($uri == "/installSql"){
    $tableArray = array('auth_list','auth_list_user','nlsys_admins','nlsys_ptoxy_amount_history','nlsys_proxy_amount','nlsys_proxy_logs','nlsys_proxy','nlsys_setting','user_soft_card_list','user_soft_device','user_soft_heartbeat','user_soft_message','user_soft_point_list','user_soft_user','user_soft_variables','user_soft_version');
    for($i=0;$i<count($tableArray);$i++){
        $tableName = $tableArray[$i];
        $arrField = $cnSql->isTable($tableName);
        if(!$arrField){
            echo 'table is not exist,name:$tableName';
            $sqlFile = 'mysql/$tableName.sql'; // 导出的SQL文件路径
            $sqlContent = file_get_contents($sqlFile); // 读取SQL文件内容
            if ($cnSql->multi($sqlContent)) {
            } else {
                echo "Error executing SQL fileName: " . $sqlFile;
            }
        }else{
            //echo $tableName."\n";
        }
    }
    
    //echo "No Problem!";
}
